/*
 * lab4.fx
 *
 * Created on 02.11.2009, 20:46:55
 */

package javafx179labs.vetkin.lab4;

/**
 * @author Алексей
 */
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.paint.Color;
import javafx.animation.* ;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.Node ;
import javafx.scene.input.* ;
import javafx.scene.shape.*;
import javafx.scene.paint.LinearGradient;
import javafx.scene.paint.Stop;



var x;
var y;
var i;
var m;
var airpl = ImageView {image: Image {url: "{__DIR__}air.png"}
                            translateX:bind x+20
                            translateY:bind y+20-m
                            } ;
/*var body = ImageView {image: Image {url: "{__DIR__}body.jpg"}
                            translateX:bind x+20 translateY:bind y+120
                            onMouseClicked: function(e: MouseEvent){
                                    anim.play();}
                            } ;
var foot = ImageView {image: Image {url: "{__DIR__}foot.jpg"}
                            translateX:bind x+50+m translateY:bind y+220
                            onMouseClicked: function(e: MouseEvent) {
                                    anim.pause();}
                            } ;
var iceC = ImageView {image: Image {url: "{__DIR__}ice_cream.jpg"}
                            translateX:bind 600-i translateY:bind 400-i} */
                            
var pluh: Path = Path {
       translateX:400 translateY:300
       stroke: Color.DODGERBLUE
       opacity: 0
       fill: LinearGradient {
           startX:60,
           startY:10,
           endX:10
           endY:80 ,
           proportional: true
           stops: [
               Stop {offset: 0.0 color: Color.DODGERBLUE},
               Stop {offset: 0.5 color: Color.LIGHTSKYBLUE},
               Stop {offset: 1.0 color: Color.WHITE}
           ]
       }
       elements: [
           MoveTo {x: 30 y: 30 },
           ArcTo {x: 100 y: 20 radiusX: 40 radiusY: 40 sweepFlag: true},
           ArcTo {x: 140 y: 40 radiusX: 40 radiusY: 40 sweepFlag: true},
           ArcTo {x: 100 y: 120 radiusX: 40 radiusY: 40 sweepFlag: true},
           ArcTo {x: 40 y: 100 radiusX: 20 radiusY: 10 sweepFlag: true},
           ArcTo {x: 30 y: 30 radiusX: 20 radiusY: 20 sweepFlag: true},
        ]
    }//Path

var SeqSc: Node[] = [airpl, pluh] ;
                    
var angle = 0;


var anim: Timeline = Timeline {
    repeatCount: Timeline.INDEFINITE
    autoReverse: false
    keyFrames: [
            at (0s) {x=>20; y=>100; i=>40; m=>10} ,
            at (4s) {y=>200 ; x=>400; m=>20 tween Interpolator.LINEAR },
            at (6s) {pluh.opacity=>1},
    ]
}

Stage{
  title: "Pinguin"
  scene:
     Scene{
       fill: Color.WHITE
       width: 800
       height: 600
       content: bind SeqSc
          
     }//Scene
}//Stage
